Golang Zakhireh – local Go proxy for offline use
Local go module proxy. Offline-first. Air-gapped. Sanctioned-country friendly.
Problem
go mod downloadfails on bad net?- Firewall blocks
proxy.golang.org? - No internet at all?
- This fixes it.
Runs locally. Caches modules on disk. Serves forever offline.
Why I Built It
- Corporate firewalls suck.
- Air-gapped labs.
- Sanctioned countries (Iran, China, etc.) — upstream proxies often blocked or unreachable.
- Athens and gomods.io? Powerful but heavy.
- Need docker-compose, config files, storage backends, sometimes databases.
- Too much for quick local setup or low-resource machines.
This Is Different
- Single binary. Minimal deps. Hackable.
- Seed once on connected machine → copy cache → run offline forever.
- No cloud. No external services. Just HTTP server.
Main Features
- Tiny dashboard:
http://localhost:8811— list modules, versions, sizes - Manual upload: drop private
.zip,.mod,.infovia UI orcurl /upload GONOSUMDBsupport built-in- Allow/deny lists:
GOLANGZAKHIREH_ALLOW,GOLANGZAKHIREH_DENY - Upstream fallback (default
proxy.golang.org) — disable for pure offline
Quick Start (Connected Machine)
bash
git clone https://github.com/GolangZakhireh/golang_zakhireh
cd golang_zakhireh
go run ./cmd/serverSet Go proxy:
bash
export GOPROXY=http://localhost:8811/proxy,direct
go get github.com/gin-gonic/ginDashboard shows cache. Download happens from upstream first time.
Config Environment Variables
bash
export GOLANGZAKHIREH_PORT=:9000
export GOLANGZAKHIREH_DATA_DIR=/var/cache/go-modules
export GOLANGZAKHIREH_UPSTREAM=https://goproxy.io # or empty for no upstream
export GONOSUMDB=github.com/mycompany/*
export GOLANGZAKHIREH_ALLOW=github.com/myorg/*
export GOLANGZAKHIREH_DENY=badmodule/*Sanctioned Countries Offline Workflow
- Use connected machine (VPN or outside sanctions). Run proxy.
go geteverything your projects need. Cache fills./data/modules. - Copy whole
data/modulesdir to USB/drive. - On offline/sanctioned machine: place
data/modulesat yourDATA_DIR. Start proxy. - Set
GOPROXY=http://localhost:8811/proxy,direct- (No upstream needed — set to empty or invalid if paranoid)
go build/go test/go mod tidyworks fully locally.
Private Modules? Upload via Dashboard or Curl
Example:
bash
curl -X POST http://localhost:8811/upload \
-F "module=github.com/mycompany/private" \
-F "version=v1.0.0" \
-F "info=@v1.0.0.info" \
-F "mod=@v1.0.0.mod" \
-F "zip=@v1.0.0.zip"Docker
bash
docker-compose up -dMounts to ./data/modules persistent directory.
Why Use This?
Simple. Lightweight. No BS deps.
Works where Athens is overkill or blocked.
Utils Repository
Scrapes Awesome-Go. Gets categories + latest versions. Dumps to txt/csv.
Workflow:
- Run on connected machine → get list → pre-download popular modules → copy cache over.
- Saves time seeding.